package cn.jingzhuan.fm.mvp.presenter

import cn.jingzhuan.fm.mvp.contract.FMAudioContract
import cn.jingzhuan.fm.mvp.contract.FMAudioDocumentContract
import cn.jingzhuan.fm.mvp.model.FMAudioDocumentModel
import cn.jingzhuan.fm.mvp.model.FMAudioModel
import cn.jingzhuan.fm.pojo.FMAudio
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import javax.inject.Inject

/**
 * Created by Administrator on 2018/5/8.
 */
class FMAudioDocumentPresenter @Inject constructor(
        private val fmAudioView: FMAudioDocumentContract.View,
        private val fmAudioModel: FMAudioDocumentModel): FMAudioDocumentContract.Presenter{

    override fun articleFind(audioId: String) {
        fmAudioModel.articleFind(audioId)
                .map {
                    it.response
                }
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe ({
                    fmAudioView.showArticle(it)
                }) {

                }
    }

}